﻿
var xmlHttp_Login;
function login() 
{ 
   GetXmlHttpObject1();
   var loginurl = "User.aspx?action=login&username=";
   loginurl = loginurl+document.getElementById("username").value+"&password="+document.getElementById("password").value;
   xmlHttp_Login.open("post",loginurl,true);
   xmlHttp_Login.onreadystatechange=onLogin;
   xmlHttp_Login.send(""); 
   
}
function onLogin()
{
     if (xmlHttp_Login.readyState == 4) 
     {  
           var msg = xmlHttp_Login.responseText;
           if(msg == "用户名或密码错误！")
           {
           alert('用户名或密码错误！');
           }
           else document.getElementById("LoginFrame").innerHTML=xmlHttp_Login.responseText;
     }
}

function GetXmlHttpObject1()
{
  try
    {
     xmlHttp_Login=new XMLHttpRequest();
    }
  catch (e)
    {
    try
      {
       xmlHttp_Login=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
       xmlHttp_Login=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
}